package com.cait.cait.controller;

import com.cait.cait.resultVo.ResultVo;
import com.cait.cait.service.VerificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @// TODO: 2020/3/26 验证码的访问控制，最后做
 * @author Jirath
 * @date 2020/3/24
 * @description: 获取验证码，利用这个验证码完成修改，当天有效
 */
@RestController("/vfc")
public class VerificationController extends BasicController{
    @Autowired
    VerificationService verificationService;
    @RequestMapping("/getMemberVfc")
    public ResultVo getMemberVfc(){
        return ResultVo.builder()
                .message("get member vfc")
                .data(verificationService.getMemberVerificationCode())
                .code(statusMsgUtil.getSucceed()).build();
    }
    @RequestMapping("/getManageVfc")
    public ResultVo getManageVfc(){
        return ResultVo.builder()
                .message("get manage vfc")
                .data(verificationService.getManageVerificationCode())
                .code(statusMsgUtil.getSucceed()).build();
    }
    @RequestMapping("/is/member")
    @ResponseBody
    public ResultVo isMemberCode(String code){
        return ResultVo.builder()
                .message("check member vfc")
                .data(verificationService.isMemberVerification(code))
                .code(statusMsgUtil.getSucceed()).build();
    }
    @RequestMapping("/is/manage")
    @ResponseBody
    public ResultVo isManageCode(String code){
        return ResultVo.builder()
                .message("check manage vfc")
                .data(verificationService.isManageVerification(code))
                .code(statusMsgUtil.getSucceed()).build();
    }
}
